import {createStore,combineReducers} from 'redux'
import {CollApsedReducer} from './reducers/CollapsedReducer'
import {LoadingReducer} from './reducers/LoadingReducer'
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage' 
const persistConfig = {
  key: 'root',
  storage,
  blacklist: ['LoadingReducer'] 
}
//因为要接收多个reducer,所以用combineReducers合并reducer
const reducer=combineReducers({
  CollApsedReducer,
  LoadingReducer
})
//将reducer进行持久化，按照persistConfig中的做法存到localStorage中
const persistedReducer = persistReducer(persistConfig, reducer)
const store = createStore(persistedReducer)
const persistor = persistStore(store)

export {store,persistor}